const collect = {
    state: {
        list:[],
        show:true
    },
    mutations: {
        Collect(state,item){
            state.list=[...item]
            if(item.length===0){
                state.show=false
            }
        },
        delcollect(state,index){
            state.list.splice(index,1)
            if(state.list.length===0){
                state.show=false
            }
        }
    },
    actions: {
        Collect(context) {
            this.$http.collects({
                params:{
                    type:1
                }
            }).then(res => {
                console.log(res.data.data.list);
                context.commit('Collect',res.data.data.list)
            })
        },
        delcollect(context,index){
            context.commit('delcollect',index)
        }

    },
    modules: {
    }
}

export default collect